/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Estrutura;
import bd.*;
import com.mysql.jdbc.Driver;
import java.sql.ResultSet;
import java.util.Vector;
import tipadas.*;

public class teste {
    Conexao con = new Conexao();

    public void conecta(){
        con.conectar(Conf_BD.driver, Conf_BD.url_BD, Conf_BD.usuario, Conf_BD.senha);
    }
    public Vector getCliente(int codigo){
        conecta();
        Vector vet = new Vector();
        ResultSet rs=con.consulta("select * from cliente where codigo='"+codigo+"';");
        try{
            while(rs.next()){
                cliente cl= new cliente();
                cl.setCodigo(rs.getInt("codigo"));
                cl.setEndereco(rs.getString("nome"));
                cl.setNome(rs.getString("endereco"));
                vet.addElement(cl);
            }
        }catch(Exception e){}
        con.desconectar();
            return vet;
         }
         public cliente getCliente(){
             conecta();
             ResultSet rs=con.consulta("select * from cliente");
             cliente cl= new cliente();
             try{
                 while(rs.next()){

                  cl.setCodigo(rs.getInt("codigo"));
                  cl.setEndereco(rs.getString("endereco"));
                  cl.setNome(rs.getString("nome"));
                 }
                }catch(Exception e){}
                 con.desconectar();
                 return cl;

        }
}
